<template>
  <el-card class="box-card">
    <div slot="header" class="clearfix"><span>视频组</span></div>
    <div class="bds">
      <el-collapse v-model="activeName">
        <el-collapse-item title="组件样式" name="c0">
          <el-form size="medium" label-width="100px">
            <el-form-item label="视频尺寸">
              <el-radio-group size="small" v-model="data.type">
                <el-radio :label="1">16:9</el-radio>
                <el-radio :label="2">1:1</el-radio>
                <el-radio :label="3">4:3</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-form>
        </el-collapse-item>
        <el-collapse-item title="内容" name="c1">
          <el-form size="medium" label-width="100px">
            <el-form-item label="封面">
              <div class="img-box"><Upload :tempUrl="data.bg" @input="getimg"></Upload></div>
            </el-form-item>
         <!--   <el-form-item label="选择视频">
              <div class="select_link" style="margin-bottom:8px;" @click="addvideo">
                <div class="select_btn select_d">
                  <i class="el-icon-link"></i>
                  <span>选择视频</span>
                </div>
              </div>
            </el-form-item> -->
            <el-form-item label="视频地址">
              <el-input v-model="data.url"></el-input>
            </el-form-item>
          </el-form>
        </el-collapse-item>
        <el-collapse-item title="基本样式" name="c1">
          <el-form size="medium" label-width="100px">
            <el-form-item label="上间距">
              <div class="slider_box">
                <el-slider class="slider_item" :max="20" v-model="data.margin.top"></el-slider>
                <el-input-number v-model="data.margin.top" :controls="false" :min="0" :max="20"></el-input-number>
              </div>
            </el-form-item>

            <el-form-item label="下间距">
              <div class="slider_box">
                <el-slider class="slider_item" :max="20" v-model="data.margin.bottom"></el-slider>
                <el-input-number v-model="data.margin.bottom" :controls="false" :min="0" :max="20"></el-input-number>
              </div>
            </el-form-item>

            <el-form-item label="左右间距">
              <div class="slider_box">
                <el-slider class="slider_item" :max="20" v-model="data.margin.lr"></el-slider>
                <el-input-number v-model="data.margin.lr" :controls="false" :min="0" :max="20"></el-input-number>
              </div>
            </el-form-item>

            <el-form-item label="上边角">
              <div class="slider_box">
                <el-slider class="slider_item" :max="50" v-model="data.radius.top"></el-slider>
                <el-input-number v-model="data.radius.top" :controls="false" :min="0" :max="50"></el-input-number>
              </div>
            </el-form-item>
            <el-form-item label="下边角">
              <div class="slider_box">
                <el-slider class="slider_item" :max="50" v-model="data.radius.bottom"></el-slider>
                <el-input-number v-model="data.radius.bottom" :controls="false" :min="0" :max="50"></el-input-number>
              </div>
            </el-form-item>
          </el-form>
        </el-collapse-item>
      </el-collapse>
    </div>
    <el-dialog title="选择视频" :visible.sync="showSelect" width="50%" append-to-body><SelectVideo :data="selectlist" @outData="close"></SelectVideo></el-dialog>
  </el-card>
</template>

<script>
import ColorPicker from '@/components/ColorPicker/index';
import SelectVideo from '@/components/SelectVideo/index';
import draggable from 'vuedraggable';
import Upload from '@/components/Upload/SingleImage2';

export default {
  data() {
    return {
      activeName: ['c0', 'c1'],
      selectlist: [],
      showSelect: false
    };
  },
  props: {
    data: {
      type: Object,
      default: {}
    }
  },
  components: {
    ColorPicker,
    SelectVideo,
    draggable,
    Upload
  },

  methods: {
    dellist(i) {
      this.data.list.splice(i, 1);
    },
    getimg(e) {
      this.data.bg = e;
    },
    addvideo() {
      this.selectlist = this.data.list;
      this.showSelect = true;
    },
    close(data) {
      this.data.list = data;
      this.showSelect = false;
    },
    remove(i) {
      this.data.list.splice(i, 1);
    }
  }
};
</script>
<style lang="scss" scoped>
//样式覆盖
.proSelect {
  width: 100%;
  border: 1px solid #dcdfe6;
  margin-bottom: 22px;

  .phead {
    background: #f4f6f8;
    font-weight: 700;
    display: flex;
    height: 40px;
    line-height: 40px;
    border-bottom: 1px solid #dcdfe6;

    .name {
      flex: 1;
      padding-left: 10px;
    }

    .price {
      width: 80px;
      text-align: center;
    }

    .action {
      width: 100px;
      text-align: center;
    }
  }

  ul {
    margin: 0;

    li {
      display: flex;
      cursor: pointer;
      line-height: 40px;
      padding: 10px 0;
      font-size: 13px;
      border-bottom: 1px solid #dcdfe6;

      // &:last-child{
      //   border-bottom: none;
      // }

      &.addPro {
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        border-bottom: none;
      }

      .dragIcon {
        width: 40px;
        height: 40px;
        text-align: center;
        font-size: 16px;
      }

      .pro {
        display: flex;
        flex: 1;

        .txt {
          display: flex;
          padding-left: 10px;
          flex: 1;
          line-height: 18px;
          align-items: center;

          .mark {
            color: #f56c6c;
            background: #f2f4f6;
            display: table;
            border-radius: 5px;
            padding: 0 3px;
            margin-right: 3px;
          }
        }
      }

      .price {
        width: 80px;
        text-align: center;
      }

      .action {
        width: 100px;
        text-align: center;
      }
    }
  }
}
.img-box {
  width: 100px;
  height: 100px;
}
.select_check .el-input__inner {
  border: none;
  background: #fff !important;
  padding: 0 !important;
  color: #333333 !important;
}
.select_check .el-button {
  padding: 0 15px;
}
.select_link {
  background: #fff;
}

.select_btn {
  padding: 4px 6px;
  color: #2d8cf0;
  box-sizing: border-box;
  border: 1px solid #e9edef;
  background: #ffffff;
}
.select_d {
  display: flex;
  align-items: center;
}
.select_d .el-icon-link {
  padding: 0 6px 0 0;
}

.select_d:hover {
  border: 1px solid #2d8cf0;
}
.select_check {
  display: flex;
  align-items: center;
  padding: 0;
  .el-icon-link {
    padding: 0 6px;
    color: #333333;
  }
}
</style>
